From 708e576c77875ef33d6d2d80de95692a4ba09023 Mon Sep 17 00:00:00 2001 From: oliskoli Date: Fri, 4 May 2007 08:44:42 +0000 Subject: [PATCH] g7towin: Fix reading of waypoint lines with empty (short)names. --- g7towin.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/g7towin.c b/g7towin.c index f3e7c7e59..5c52a7751 100644 --- a/g7towin.c +++ b/g7towin.c @@ -272,17 +272,21 @@ parse_waypt(char *buff) if (gardown) cin = buff + 6; - else + else { + /* We've seen waypoints with length of 14 and 15 !!! */ cin = buff + 15; + while ((cin > buff) && (! isspace(*cin))) cin--; + } while (isspace(*cin)) cin--; if (cin >= buff) wpt->shortname = xstrndup(buff, cin - buff + 1); if (gardown) - buff += 7; + buff += 6; else - buff += 16; + buff += 15; + while (isspace(*buff)) buff++; buff += parse_coordinates(buff, datum, grid, &wpt->latitude, &wpt->longitude, MYNAME); @@ -438,7 +442,7 @@ data_read(void) case 'P': /* proximity waypoint */ case 'W': /* normal waypoint */ - wpt = parse_waypt(cdata); + wpt = parse_waypt(cin + 3); prev = wpt; if (wpt) { if (mode == rtedata) -- 2.30.2